package com.asset.salesforce.dao;

import java.util.ArrayList;
import java.util.List;

import com.asset.salesforce.domain.InvoiceItem;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

@Repository
public class InvoiceItemDaoImpl extends BasicDaoImpl<InvoiceItem> {
	public List<InvoiceItem> getInvoiceItemsByInvoice(Integer id){
		Session session =sessionFactory.getCurrentSession();
		Query query = session.createQuery("from InvoiceItem where invoice.id= :id");
		query.setParameter("id", id);
		List<InvoiceItem> invoiceItemsList = new ArrayList<InvoiceItem>();
		invoiceItemsList = query.list();
		return invoiceItemsList;
	}
}
